<?php
//
defined('BY_JYA') or exit('error');
$_RQ['op']=$_RQ['op']?$_RQ['op']:'main';
$return['params']=array('jy'=>1);
if($_RQ['op']=='main'){
	//下面list,PC端需要获取商品列表
	$params=array(
		'uniacid'=>$_SESSION['uniacid'],
		'status'=>1,
	);
	set_html('title',$return['shopset']['title']?:'商品列表');
	$return['sharedata']=array(
		'title'=>$return['setting']['share_title']?'全部商品'.$return['setting']['share_title']:'全部商品-拼单商城',
		'desc'=>$return['setting']['share_desc']?$return['setting']['share_desc']:'拼单商城，一个属于自己的个人商城！',
		'link'=>custom_url('jy_xunichong/goods.index//fromuser='.$_SESSION['uid'],true),
		'imgUrl'=>ATTACHMENT_URL.$return['setting']['share_image']
	);
	exi($return);
}
// js 获取数据
if($_RQ['op']=='getlist'){
	$params=array(
		'uniacid'=>$_SESSION['uniacid'],
		'status'=>1,
	);
	if(isset($_RQ['type'])){
		$params['type']=intval($_RQ['type']);
	}
	//进一步整理筛选条件，商品属性字段是否需 要调整，商品分类如何筛选，orderby如何整理
	$pindex = max(1, intval($_RQ['page']));
	$psize = 10;
	if($_RQ['num']){
		$psize=$_RQ['num'];
	}
	$total='';
	$fields=array('id','title','image','groupid','price','oldprice','type');
	$list=pdo_getslice('jy_xunichong_goods',$params,array($pindex,$psize),$total,$fields,'','star desc,id desc');
	if(!$list){
		exi('none');
	}else{
		foreach($list as &$itemv){
			$itemv['image']=$itemv['image']?tomedia($itemv['image']):'';
			$itemv['typetitle']=$this->gift_type[$itemv['type']];
			$itemv['group']=pdo_get('jy_xunichong_group',array('id'=>$itemv['groupid'],'uniacid'=>$_SESSION['uniacid']),array('pay_type','ewm','payurl'));
		}
	}
	exi($list);
}	
?>